home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWExcLib / Include / FWBreakC.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-08  |  3.4 KB  |  130 lines  |  [TEXT/MPS ]

  1. #ifndef FWBREAKC_H
  2. #define FWBREAKC_H
  3.  
  4. //========================================================================================
  5. //
  6. //    File:                FWBreakC.h
  7. //    Release Version:    $ 1.0d11 $
  8. //
  9. //    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef   FWAUTODE_H
  14. #include "FWAutoDe.h"
  15. #endif
  16.  
  17. #ifndef FWEXCDEF_H
  18. #include "FWExcDef.h"
  19. #endif
  20.  
  21. #ifndef FW_NATIVE_EXCEPTIONS
  22.  
  23. #ifndef   FWCLAINF_H
  24. #include "FWClaInf.h"
  25. #endif
  26.  
  27. #endif // FW_NATIVE_EXCEPTIONS
  28.  
  29. #if FW_LIB_EXPORT_PRAGMAS
  30. #pragma lib_export on
  31. #endif
  32.  
  33. //========================================================================================
  34. // CLASS FW_CExceptionThrowPoint
  35. //
  36. //        A helper class for exception debugging.
  37. //        See the macro FW_DECLARE_THROW_POINT and FW_CHECK_THROW_POINT
  38. //========================================================================================
  39.  
  40. #ifdef FW_DEBUG
  41.  
  42. /*    FW_CExceptionThrowPoint can be declared globally and will insert
  43.     themselves into a global linked list. This list can be iterated
  44.     over and individual throw points can be set to throw an exception
  45.     when checked.
  46.     Be aware that in a shared library situation this list will be
  47.     global to the *process*, not just the part. Therefore a throw
  48.     point in shared code may be triggered by a different part
  49.     exersizing the same code.
  50. */
  51.  
  52. class FW_CLASS_ATTR FW_CExceptionThrowPoint
  53. {
  54. public:
  55.                     FW_CExceptionThrowPoint (const char * name);
  56.                     ~FW_CExceptionThrowPoint ();
  57.     void             Check ();
  58.     inline void     ThrowWhenChecked (FW_Boolean throwOrNot);
  59.     inline const char * GetName () const;
  60.     inline FW_Boolean HasBeenChecked () const;
  61.     inline FW_Boolean WillThrowWhenChecked () const;
  62.     inline FW_CExceptionThrowPoint * Next () const;
  63.     static inline FW_CExceptionThrowPoint * First ();
  64. private:
  65.     const char *     fName;
  66.     FW_Boolean         fHasBeenChecked;
  67.     FW_Boolean         fThrowWhenChecked;
  68.     FW_CExceptionThrowPoint * fNext, * fPrevious;
  69.     static FW_CExceptionThrowPoint * gFirst;
  70. };
  71.  
  72. #endif
  73.  
  74. #ifndef FW_NATIVE_EXCEPTIONS
  75.  
  76. //========================================================================================
  77. // CLASS FW_CExceptionBreakContext
  78. //
  79. //        A helper class for exception debugging.  See the macro FW_EXCEPTION_BREAK_CONTEXT
  80. //========================================================================================
  81.  
  82. #ifdef FW_DEBUG
  83. class FW_CLASS_ATTR FW_CExceptionBreakContext FW_AUTO_DESTRUCT_OBJECT
  84. {
  85. public:
  86.     FW_CExceptionBreakContext(FW_ClassInfoPtr breakExceptionKind);
  87.     virtual ~ FW_CExceptionBreakContext();
  88.  
  89. private:
  90.     FW_ClassInfoPtr fLastBreakExceptionKind;
  91. };
  92. #endif
  93.  
  94. #endif // FW_NATIVE_EXCEPTIONS
  95.  
  96. #if FW_LIB_EXPORT_PRAGMAS
  97. #pragma lib_export off
  98. #endif
  99.  
  100. //========================================================================================
  101. // FW_CExceptionThrowPoint Inlines
  102. //========================================================================================
  103.  
  104. #ifdef FW_DEBUG
  105.  
  106. inline void FW_CExceptionThrowPoint::ThrowWhenChecked (FW_Boolean throwOrNot) {
  107.     fThrowWhenChecked = throwOrNot;
  108. }
  109.  
  110. inline const char * FW_CExceptionThrowPoint::GetName () const {
  111.     return fName;
  112. }
  113.  
  114. inline FW_Boolean FW_CExceptionThrowPoint::HasBeenChecked () const {
  115.     return fHasBeenChecked;
  116. }
  117.  
  118. inline FW_Boolean FW_CExceptionThrowPoint::WillThrowWhenChecked () const {
  119.     return fThrowWhenChecked;
  120. }
  121.  
  122. inline FW_CExceptionThrowPoint * FW_CExceptionThrowPoint::Next () const {
  123.     return fNext;
  124. }
  125.  
  126. #endif // FW_DEBUG
  127.  
  128. #endif
  129.  
  130.